import request from "@/util/axios";


export const mangaPage = (page) =>
    request({
        url: "/api/manga/homePage",
        method: "post",
        data: {...page}
    })

export const mineMangaPage = (page, keyword, isAvailable) =>
    request({
        url: "/api/manga/mineMange",
        method: "post",
        data: {...page, keyword, isAvailable}
    })

export const saveManga = (mangaForm) => {
    return request({
        url: "/api/manga/save",
        method: "post",
        data: {...mangaForm}
    })
}

export const updateManga = (mangaForm) => {
    return request({
        url: "/api/manga/update",
        method: "post",
        data: {...mangaForm}
    })
}

export const checkNameExist = (name) =>
    request({
        url: "/api/manga/checkNameExist",
        method: "get",
        params: {name}
    })

export const deleted = (mangaId) =>
    request({
        url: "/api/manga/deleted",
        method: "get",
        params: {mangaId}
    })

export const available = (mangaId, isAvailable) =>
    request({
        url: "/api/manga/available",
        method: "get",
        params: {mangaId, isAvailable}
    })

export const mangaDt = (mangaId) =>
    request({
        url: "/api/manga/info/" + mangaId,
        method: "get"
    })

export const epList = (mangaId) =>
    request({
        url: "/api/manga/epList/" + mangaId,
        method: "get"
    })

export const nocacheEpList = (mangaId) =>
    request({
        url: "/api/manga/nocache/epList/" + mangaId,
        method: "get"
    })

export const mangaMember = (mangaId) =>
    request({
        url: "/api/manga/mangaMember",
        method: "get",
        params: {mangaId}
    })

export const mangaMemberByEp = (epId) =>
    request({
        url: "/api/manga/mangaMemberByEp",
        method: "get",
        params: {epId}
    })

export const position = () =>
    request({
        url: "/api/manga/position",
        method: "get"
    })

export const changePosition = (data) =>
    request({
        url: "/api/manga/changePosition",
        method: "post",
        data: data
    })

export const appendMember = (data) =>
    request({
        url: "/api/manga/appendMember",
        method: "post",
        data: data
    })

export const removeMember = (mangaId, uid) =>
    request({
        url: "/api/manga/removeMember",
        method: "get",
        params: {mangaId, uid}
    })

export const heatRanking = (cycle) =>
    request({
        url: "/api/manga/heatRanking",
        method: "get",
        params: {cycle}
    })

export const updateRanking = (cycle) =>
    request({
        url: "/api/manga/updateRanking",
        method: "get",
        params: {cycle}
    })

export const plusView = (mangaId) =>
    request({
        url: "/api/manga/plusView",
        method: "get",
        params: {mangaId}
    })

export const searchManga = (page) =>
    request({
        url: "/api/manga/searchManga",
        method: "post",
        data: page
    })

export const likeCount = (mangaId) =>
    request({
        url: "/api/manga/likeCount",
        method: "get",
        params: {mangaId}
    })

export const like = (mangaId, isLike) =>
    request({
        url: "/api/manga/like",
        method: "get",
        params: {mangaId, isLike}
    })